package yxy.game.pm2.module.soloride;

import java.util.Collection;

import yxy.game.pm2.bean.Currency;
import yxy.game.pm2.bean.currency.Currencies;
import yxy.game.pm2.bean.mq.CCReason;
import yxy.game.pm2.module.CurrencyHandle;
import yxy.game.pm2.module.battle.ISettlement;

/** 过关斩将的战斗结算 */
public class SettlementSoloRide implements ISettlement {
	// bean===========================================================================

	private String playerCode;
	private Currencies rewards = new Currencies();
	private int stage;

	public String getPlayerCode() {
		return playerCode;
	}

	public void setPlayerCode(String playerCode) {
		this.playerCode = playerCode;
	}

	public Currencies getRewards() {
		return rewards;
	}

	public void setRewards(Currencies rewards) {
		this.rewards = rewards;
	}

	public int getStage() {
		return stage;
	}

	public void setStage(int stage) {
		this.stage = stage;
	}
	// func===========================================================================

	@Override
	public void settle() {
//		System.err.println("CC::" + getRewards());
		new CurrencyHandle().addCurrency(playerCode, CCReason.千里单骑, getRewards());
		new SoloRideHandle().settleStage(playerCode, getStage());
	}

	@Override
	public Collection<Currency> reward() {
		return getRewards();
	}

	static public SettlementSoloRide create(String playerCode, int stage) {
		SettlementSoloRide settlement = new SettlementSoloRide();
		try {
			settlement.setPlayerCode(playerCode);
			settlement.setStage(stage);

			return settlement;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}

}
